<?php
global $_GPC, $_W;
$GLOBALS['frames'] = $this->getMainMenu();

$pageindex = max(1, intval($_GPC['page']));
$pagesize=10;
$where=' WHERE  a.uniacid=:uniacid and  a.m_id=:m_id ';
$data[':uniacid']=$_W['uniacid'];
$data[':m_id']=$_GPC['id'];


 //  	$sql="SELECT * FROM ".tablename('zh_yjm_moneyinfox') .$where." ORDER BY time desc";
	// $total=pdo_fetchcolumn("SELECT count(*) FROM ".tablename('zh_yjm_moneyinfox').$where." ORDER BY time desc",$data);

  	$sql="SELECT a.*,b.assistant,c.title,d.project,f.store FROM ".tablename('zh_yjm_moneyinfox'). " a left join ". tablename("zh_yjm_assistant")." b on a.ass_id=b.id left join ". tablename("zh_yjm_projecttype")." c on a.projecttype_id=c.id left join ". tablename("zh_yjm_project")." d on a.project_id=d.id  left join ". tablename("zh_yjm_cusmember")." e on a.m_id=e.id left join ". tablename("zh_yjm_store")." f on e.store_id=f.id ".$where." ORDER BY a.time desc";
	$total=pdo_fetchcolumn("SELECT count(*) FROM ".tablename('zh_yjm_moneyinfox'). " a left join ". tablename("zh_yjm_assistant")." b on a.ass_id=b.id left join ". tablename("zh_yjm_projecttype")." c on a.projecttype_id=c.id left join ". tablename("zh_yjm_project")." d on a.project_id=d.id  left join ". tablename("zh_yjm_cusmember")." e on a.m_id=e.id left join ". tablename("zh_yjm_store")." f on e.store_id=f.id ".$where." ORDER BY a.time desc",$data);

$select_sql =$sql." LIMIT " .($pageindex - 1) * $pagesize.",".$pagesize;
$memsx=pdo_fetchall($select_sql,$data);
$pager = pagination($total, $pageindex, $pagesize);

include $this->template('web/amemsxx');